package com.sf.fy.uav.rest;

import com.sf.fy.uav.common.request.common.IdRequest;
import com.sf.fy.uav.common.request.operate.SysBannerRequest;
import com.sf.fy.uav.common.request.order.DealRequest;
import com.sf.fy.uav.common.response.operational.BannerResponse;
import com.sf.fy.uav.common.response.operational.SysBannerResponse;
import com.sf.fy.uav.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-06-28
 */
@RestController
@RequestMapping("/home/banner")
public class BannerRest {

    @Autowired
    private IBannerService iBannerService;

    public Long getTotal(@RequestParam(required = false) String name,
                         @RequestParam(required = false) Integer status) {
        return iBannerService.getTotal(name, status);
    }

    public List<SysBannerResponse> getBanners(SysBannerRequest sysBannerRequest) {
        return iBannerService.getBanners(sysBannerRequest);
    }

    public List<BannerResponse> getBanners() {
        return iBannerService.getBanners();
    }


    public void off(@RequestBody DealRequest dealRequest) {
        iBannerService.off(dealRequest);
    }

    public Integer start(@RequestBody IdRequest idRequest) {
        return iBannerService.start(idRequest);
    }

    public Integer end(@RequestBody IdRequest idRequest) {
        return iBannerService.end(idRequest);
    }

    public void delete(@RequestBody DealRequest dealRequest) {
        iBannerService.delete(dealRequest);
    }

    public SysBannerResponse getById(@RequestParam String bannerId) {
        return iBannerService.getById(bannerId);
    }
}
